﻿<%@ Page Title="Parts - Purchase Order Pending Edit" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="POPendingEdit.aspx.cs" Inherits="VSM.Parts.POPendingEdit" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">


        function OpenItemPopup() {
            var url = "../../../ItemPartPopup.aspx?itmgrp=102";
            Main.openCustomDialog(url, 600, 610, "Accessories - Item Master Data");
        }

        function OpenBP() {
            var url = "../../../BPPopup.aspx?CardType=S";
            Main.openCustomDialog(url, 600, 610, "Business Partner List");
        }
        function OpenDocList(docktype, title) {
            var url = "../../../DocumentList.aspx?DocType=" + docktype
            Main.openCustomDialog(url, 800, 610, title);
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hdnIsUpdate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <asp:HiddenField ID="hdnIsCreatedSO" runat="server" />
                <h2>
                    &nbsp;<asp:Label ID="lblTitle" runat="server" Text="Parts - Purchase Order Pending List"></asp:Label>
                </h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">PO No.:</td>
                            <td>
                                <asp:TextBox ID="txtPONo" runat="server" BackColor="#E6E6E6" ReadOnly="True" 
                                    Width="100px"></asp:TextBox>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 100px;">Status:</td>
                            <td align="left">
                                <asp:Label ID="lblStatus" runat="server" Text="Open" ForeColor="Red"></asp:Label>
                            </td>
                            <td align="right" style="display:none;">
                                <asp:Button ID="btnDocList" runat="server" OnClientClick="OpenDocList('22', 'Purchases Order Pending Edit'); return false;" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Text="List" Width="60px" Enabled="False" Visible="False" />
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 150px;">Posting Date:</td>
                            <td style="width: 250px">
                                <asp:TextBox ID="txtPostingDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtPostingDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgPostingDate" TargetControlID="txtPostingDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPostingDate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">PO Type:</td>
                            <td colspan="2">
                              <asp:DropDownList ID="ddlPOType" runat="server" Enabled="false" >
                                    <asp:ListItem Value="0">mO</asp:ListItem>
                                    <asp:ListItem Value="1">eO</asp:ListItem>
                                    <asp:ListItem Value="2">DO</asp:ListItem>
                                    <asp:ListItem Value="3">Special</asp:ListItem>
                                      <asp:ListItem Value="4">Special 1</asp:ListItem>
                                        <asp:ListItem Value="5">Special 2</asp:ListItem>
                                      
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddlVSMPOType" runat="server" >
                                    <asp:ListItem Value="7">Sea</asp:ListItem>
                                    <asp:ListItem Value="8">Air</asp:ListItem>
                                    <asp:ListItem Value="9">VOR</asp:ListItem>
                                    <asp:ListItem Value="10">Initial Stock</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Delivery Date:</td>
                            <td valign="top">
                                <asp:TextBox ID="txtDelDate" runat="server" Width="100px"></asp:TextBox>
                                <asp:ImageButton ID="imgDeldate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtDelDate"
                                    PopupButtonID="imgDeldate" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Approve 
                                Status:</td>
                            <td colspan="2">

                                <asp:DropDownList ID="ddlAppStatus" runat="server" Enabled="False">
                                    <asp:ListItem Value="0">New</asp:ListItem>
                                    <asp:ListItem Value="1">Approved</asp:ListItem>
                                    <asp:ListItem Value="2">Rejected</asp:ListItem>
                                </asp:DropDownList>

                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">Doc. Date:
                            </td>
                            <td colspan="4">
                                <asp:TextBox ID="txtPODate" runat="server" AutoPostBack="True" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yyyy" 
                                    PopupButtonID="imgPODate" TargetControlID="txtPODate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPODate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />                            
                            </td>
                        </tr>
                    </table>
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" style="white-space: nowrap; width: 150px" valign="middle">
                                Vendor:
                            </td>
                            <td class="FormLineItemAlt" colspan="3">
                                <asp:TextBox ID="txtVendorCode" runat="server" ReadOnly="True" style="width: 13%;" BackColor="#E6E6E6"></asp:TextBox>
                                <asp:TextBox ID="txtVendorName" runat="server"  style="width: 35%;"></asp:TextBox>
                                <asp:Button ID="btnSelectVendor" runat="server" OnClientClick="OpenBP(); return false;"
                                    Text="..." 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; font-weight: bold" 
                                    Enabled="False" Visible="False" />
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle" style="width: 150px">
                                <asp:Label ID="lblConPersonName" runat="server">Contact Person:</asp:Label> 
                            </td>
                            <td class="FormLineItem" colspan="3">
                                <asp:TextBox ID="txtConpersonName" runat="server" style="width: 50%;"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="middle" colspan="4" style="display:none;">
                                <asp:Button ID="btnAddItems" runat="server" Text="Add new item"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Width="110px" Enabled="False" 
                                    OnClientClick="OpenItemPopup(); return false;" />
                                <asp:FileUpload ID="FileUploadControl" runat="server" Enabled="False" 
                                    Visible="False" />
                                <asp:Button ID="btnImport" runat="server" onclick="btnImport_Click" text="Import" 
                                    
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Width="60px" Enabled="False" Visible="False" />
                            </td>
                        </tr>
                    </table>
                    <hr />
                    <div style="width: 100%">
                        <asp:GridView ID="grvPO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" OnRowEditing="EditItem"
                            OnRowUpdating="UpdateItem" HeaderStyle-VerticalAlign="Middle" OnRowCancelingEdit="CancelEdit"
                            AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" PageSize="20"
                            OnRowDeleting="DeleteItem" OnRowDataBound="grvSearchResult_RowDataBound">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" TabIndex="-1" OnClick="lnkDelete_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                <asp:TemplateField HeaderText="Item Code">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemCode" runat="server" Text='<%# Bind("ItemCode") %>' ></asp:Label>
                                        <asp:HiddenField ID="hdnVatGroup" runat="server" Value='<%# Bind("Taxcode") %>'></asp:HiddenField>
                                        <asp:HiddenField ID="hdnRate" runat="server" Value='<%# Bind("VatPrcnt") %>'></asp:HiddenField>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item Name">
                                    <ItemStyle HorizontalAlign="left" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemName" runat="server" Text='<%# Bind("Dscription") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="UoM">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtUoM" runat="server" Text='<%# Bind("unitMsr") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Model" >
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblModel" runat="server" Text='<%# Bind("U_Model") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Product" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblProduct" runat="server" Enabled="false" Text='<%# Bind("U_Product") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Color" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblColor" runat="server" Text='<%# Bind("U_Color") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                               
                                <asp:TemplateField HeaderText="Order Qty.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtOrderQuantity" ReadOnly="true" runat="server" Width="97%" Text='<%# Bind("Quantity") %>' BorderStyle="None" BackColor="Transparent"
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right" OnTextChanged="txtOrderQuantity_OnTextChanged"/>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Unit Price">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtUnitPrice" Style="text-align: right" Width="97%" runat="server" Text='<%# Bind("PriceBefDi") %>' ReadOnly="true" BackColor="Transparent" BorderStyle="None"
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtUnitPrice_OnTextChanged"/>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Disc. (%)">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="80px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtDiscPrcnt" Style="text-align: right" Width="97%" runat="server" Text='<%# Bind("DiscPrcnt") %>' ReadOnly="true" BackColor="Transparent" BorderStyle="None"
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txtDiscPrcnt_OnTextChanged"/>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Price After Disc" Visible="false">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblPrice" Style="text-align: right" runat="server" Text='<%# Bind("Price") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Line Total">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="120px" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtLineTotal" runat="server" Text='<%# Bind("LineTotal") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#6095C9"  ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all" cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <th>
                                            <span>Action</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                        <th>
                                            <span>Item Code</span>
                                        </th>
                                        <th>
                                            <span>Item Name</span>
                                        </th>

                                        <th>
                                            <span>UoM</span>
                                        </th>
                                        <th>
                                            <span>Order Qty.</span>
                                        </th>
                                        <th>
                                            <span>Unit Price</span>
                                        </th>
                                        <th>
                                            <span>Discount (%)</span>
                                        </th>
                                        <th>
                                            <span>Line Total</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="13">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
                    <hr width="100%" />
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td valign="top" style="width: 70%">
                            <table style="width: 100%;">
                                <tr>
                                    <td style="width: 10%;">
                                        <strong>Remarks :</strong>
                                    </td>
                                    <td style="width: 50%;">
                                        <asp:TextBox runat="server" style=" width: 98%;" ID="txtRemarks" Height="71px" TextMode="MultiLine"></asp:TextBox>
                                    </td>
                                    <td style="width: 10%;">
                                        <strong>Buyer:</strong>
                                    </td>
                                    <td style="width: 30%;">
                                        <asp:DropDownList ID="ddlBuyer" style=" width: 100%;" runat="server"></asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style="width: 30%" align="right">
                            <div style="margin-right: 5px;">
                                <table border="0">
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td align="right">Sub Total:</td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblSubTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td align="right">Discount:</td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblDiscAmount" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none; background-color: rgb(96, 149, 201);">
                                        <td align="right">Tax Amount:</td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblTaxAmount" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; font-weight: bold; text-decoration: none; background-color: #D9E0ED;">
                                        <td style="width: 150px" align="right">Grand Total:</td>
                                        <td align="right">
                                            <asp:Label ID="lblDocumentTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="margin-left: 5px; width: 99%;">
                                <hr />
                            </div>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 360px;">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnSave_Click" 
                                            BorderStyle="Solid" Width="60px" Enabled="False" Visible="False" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnCancel_Click" 
                                            BorderStyle="Solid" Width="60px" Enabled="False" Visible="False" />
                                        <asp:Button ID="btnApprove" runat="server" Text="Approve" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnApprove_Click" 
                                            BorderStyle="Solid" Enabled="False" Width="60px" />
                                        <asp:Button ID="btnReject" runat="server" BorderStyle="Solid" Enabled="False" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Reject" Width="60px" onclick="btnReject_Click" />
                                        <asp:Button ID="btnPrint" runat="server" BorderStyle="Solid" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="Print" Width="60px" Enabled="False" Visible="False" />
                                        <asp:Button ID="btnLastRecord" runat="server" BorderStyle="Solid" 
                                            OnClick="btnLastRecord_Click" 
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat; color: White;" 
                                            Text="&gt;&gt;" ToolTip="Last record" Width="40px" Enabled="False" 
                                            Visible="False" />
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                    <td align="right" style="width: 240px;display:none;">
                                        <asp:Button ID="btnCopyToGRPO" runat="server" Text="Copy to GRPO." Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" 
                                            onclick="btnCopyToGRPO_Click" Width="110px" />
                                        <asp:Button ID="btnCopyToAPInvoice" runat="server" Text="Copy to A/P Invoice" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" 
                                            onclick="btnCopyToAPInvoice_Click" Width="120px" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger  ControlID="btnImport" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
